<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>系统配置参数</title>
<link type="text/css" rel="stylesheet" href="main.css"/>
<script src="jquery.js" language="javascript" type="text/javascript"></script>
<script src="base.js" language="javascript" type="text/javascript"></script>

<script language='javascript'>
function Nav()
{
	if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE';
	else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF';
	else return "OT";
}
function $Obj(objname)
{
	return document.getElementById(objname);
}
function ShowConfig(em,allgr)
{
	for(var i=1;i<=allgr;i++)
	{
		if(i==em) $Obj('td'+i).style.display = (Nav()=='IE' ? 'block' : 'table');
		else $Obj('td'+i).style.display = 'none';
	}
	$Obj('addvar').style.display = 'none';
}

function ShowHide(objname)
{
	var obj = $Obj(objname);
	if(obj.style.display != "none") obj.style.display = "none";
	else obj.style.display = (Nav()=='IE' ? 'block' : 'table-row');
}
</script>
</head>
<body>
<div class="mtitle">
  <div class="lbox">系统配置参数</div>
</div>

<table _dlist="line" class="tlist">
<tbody>
<tr>
<td height="24" bgcolor="#ffffff" align="center">
<?php
$ds = file(DEDEADMIN.'/inc/configgroup.txt');
$totalGroup = count($ds);
$i = 0;
foreach($ds as $dl)
{
	$dl = trim($dl);
	if(empty($dl)) continue;
	$dls = explode(',',$dl);
	$i++;
	if($i>1) echo " | <a href='javascript:ShowConfig($i,$totalGroup)'>{$dls[1]}</a> ";
	else{
		echo " <a href='javascript:ShowConfig($i,$totalGroup)'>{$dls[1]}</a> ";
	}
}
?>
<!--| <a href="#" onClick="ShowHide('addvar')">添加新变量</a></td>-->
</tr>
<tr id="addvar" style="display:none">
<td height="24" bgcolor="#ffffff" align="center">
  <form name="fadd" action="sys_info.php" method="post">
  	<input type='hidden' name='dopost' value='add'>
		<table width="98%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="12%" height="26">变量名称：</td>
              <td width="38%"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:80%" /></td>
              <td width="12%" align="center">变量值：</td>
              <td width="38%"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:80%" /></td>
            </tr>
            <tr>
              <td width="10%" height="26">变量类型：</td>
              <td colspan='3'>
              	<input name="vartype" type="radio"  value="string" class='np' checked='checked' />
                文本
                <input name="vartype" type="radio"  value="number" class='np' />
                数字
                <input type="radio" name="vartype" value="bool" class='np' />
                布尔(Y/N)
                <input type="radio" name="vartype" value="bstring" class='np' />
                多行文本
              </td>
            </tr>
            <tr>
              <td height="26">参数说明：</td>
              <td><input type="text" name="varmsg"  id="varmsg" class="npvar" style="width:80%" /></td>
              <td align="center">所属组：</td>
              <td>
                <?php
                echo "<select name='vargroup' class='npvar'>\r\n";
                foreach($ds as $dl){
                	$dl = trim($dl);
                	if(empty($dl)) continue;
                	$dls = explode(',',$dl);
                	echo "<option value='{$dls[0]}'>{$dls[1]}</option>\r\n";
                }
                echo "</select>\r\n";
			  ?>    <input type="submit" name="Submit" value="保存变量" class="np coolbg" />
              </td>
            </tr>
          </table>
	 </form>
	</td>
</tr>
</tbody>
</table>

<table _dlist="line" class="tlist">
<tr>
<td height="28" align="center">&nbsp;提示：网站名称、关键字等资料只适合默认语言入口页，如果要需设定多语言的资料，请在（<a href='lang_main.php'><u>自定义资料</u></a>）里设置。</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" width="100%">
<form action="sys_info.php" method="post" name="form1">
<input type="hidden" name="dopost" value="save">
<?php
$n = 0;
if(!isset($gp)) $gp = 1;
foreach($ds as $dl)
{
	$dl = trim($dl);
	if(empty($dl)) continue;
	$dls = explode(',',$dl);
	$n++;
?>
<table width="100%" style='<?php if($n!=$gp) echo "display:none"; ?>' id="td<?php echo $n?>" border="0" cellspacing="1" cellpadding="1">
<tr align="center" bgcolor="#F7FAF3" height="25">
<td width="35%">参数说明</td>
<td width="45%">参数值</td>
<td width="20%">变量名</td>
</tr>
<?php
//echo "Select * From `#@__sysconfig` where groupid='{$dls[0]}' order by aid asc<br />";
$dsql->SetQuery("Select * From `#@__sysconfig` where groupid='".trim($dls[0])."'  and `off` = 0 order by aid asc");
$dsql->Execute();
$i = 1;
while($row = $dsql->GetArray())
{
	if($i%2==0)
	{
		$bgcolor = "#FFFFFF";
	}
	else
	{
		$bgcolor = "#FAFEE9";
	}
	$i++;
?>
<tr align="center" height="25" bgcolor="<?php echo $bgcolor?>">
<td>
<?php echo $row['info']; ?>：
</td>
<td align="left">
<?php
if($row['type']=='bool')
{
	$c1='';
	$c2 = '';
	$row['value']=='Y' ? $c1=" checked" : $c2=" checked";
	echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='Y'$c1>是 ";
	echo "<input type='radio' class='np' name='edit___{$row['varname']}' value='N'$c2>否 ";
}else if($row['type']=='bstring')
{
	echo "<textarea name='edit___{$row['varname']}' row='4' id='edit___{$row['varname']}' style='width:100%;height:50px'>".htmlspecialchars($row['value'])."</textarea>";
}else if($row['type']=='number')
{
	echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' style='width:30%'>";
}else
{
	echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".htmlspecialchars($row['value'])."\" style='width:80%'>";
}
?>
</td>
<td><?php echo $row['varname']?></td>
</tr>
<?php
}

?>
</table>
<?php
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr bgcolor="#F3FFDD">
<td height="50" colspan="3">
<table width="98%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="11%">&nbsp;</td>
<td width="11%">
<button type="submit" class="btn1">确定</button>
</td>
<td width="78%"><button type="button" class="btn1" onClick="document.form1.reset()">重置</button></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>

</table>
</body>
</html>